﻿/*=================================================================
* 版权信息：Copyright (C) 2005-2011 捷点科技 All Rights Reserved.
* 文件名称：CNVP_Admin.cs
* 创建标识：曾乃强 15158756652 2011-03-14 03:03:16
* 修改标识：
* 功能描述：
===================================================================*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using CNVP.Framework.Helper;

namespace CNVP.JShop.BLL 
{
    public class CNVP_Admin
    {
        DAL.CNVP_Admin dal = new DAL.CNVP_Admin();
        
        #region BLL
        #region 添加
        /// <summary>
        /// 添加
        /// </summary>
        public int Add_CNVP_Admin(Model.CNVP_Admin obj)
        {
            return dal.Insert(obj);
        }
        #endregion

        #region 修改
        /// <summary>
        /// 修改
        /// </summary>
        public int Update_CNVP_Admin(Model.CNVP_Admin obj)
        {
            return dal.Update(obj);
        }

        #endregion

        #region 删除
        /// <summary>
        /// 删除
        /// </summary>
        public int Delete_CNVP_Admin(Model.CNVP_Admin obj)
        {
            return dal.Delete(obj);
        }

        /// <summary>
        /// 删除,生成列的主键列构成的参数列表
        /// </summary>
        public int Delete_CNVP_Admin(int ID)
        {
            return this.Delete_CNVP_Admin(new Model.CNVP_Admin()
            {

                ID = ID
            });
        }
        #endregion 

        /// <summary>
        /// 查看单个
        /// </summary>
        public Model.CNVP_Admin GetSingle_CNVP_AdminById(int ID)
        {
            return dal.LoadById(ID);
        }
        /// <summary>
        /// 查看全部
        /// </summary>
        public List<Model.CNVP_Admin> GetAll_CNVP_Admin()
        {
            return dal.LoadAll();
        }

        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="UserName">用户名</param>
        /// <param name="UserPwd">密码</param>
        /// <returns></returns>
        public Model.CNVP_Admin cust_LoginByName(Model.CNVP_Admin obj)
        {
            return dal.cust_LoginByName(obj);
        }

        public int cust_UpdateLogin(Model.CNVP_Admin obj)
        {
            return dal.cust_UpdateLogin(obj);
        }
        #endregion

        public DataTable GetPage(string PageName, int PageIndex, int PageSize, out int RecordCount, out int PageCount, params SQLConditionInfo[] SqlCondition)
        {
            return dal.GetPage(PageName, PageIndex, PageSize, out RecordCount, out PageCount, SqlCondition);
        }

        public List<Model.CNVP_Admin> QurryListByAdminName(string AdminName)
        {
            return dal.QurryListByAdminName(AdminName);
        }

        /// <summary>
        /// 自定义查看单个 ByAdminName
        /// </summary>
        public Model.CNVP_Admin GetSingle_CNVP_AdminByAdminName(string AdminName)
        {
            return dal.cust_LoadByAdminName(AdminName);
        }

        /// <summary>
        /// 判断是否存在旧密码
        /// </summary>
        public int IsOldPwd(string OldPwd, string AdminName)
        {
            return dal.IsOldPwd(OldPwd, AdminName);
        }

        /// <summary>
        /// 旧密码存在，更新密码
        /// </summary>
        public int UpdatePwd(string AdminPass, string AdminName)
        {
            return dal.UpdatePwd(AdminPass, AdminName);
        }
    }
}

